import request from '@/utils/request'


// 查询商品信息列表
export function listInfopi(query) {
  return request({
    url: '/shopping/goods/listpi',
    method: 'get',
    params: query
  })
}

export function listlabelfindall(productPicId) {
  return request({
    url: '/shopping/goods/listlabelfindall/'+productPicId,
    method: 'get',
    params: ""
  })
}


export function listlabelfindproduct(productId) {
  return request({
    url: '/shopping/goods/listlabelfindproduct/'+productId,
    method: 'get',
    params: ""
  })
}



// 查询商品信息详细
export function getInfopi(productId) {
  return request({
    url: '/shopping/goods/' + productId,
    method: 'get'
  })
}

export function getInfolab(labelId) {
  return request({
    url: '/shopping/goods/getInfolab/' + labelId,
    method: 'get'
  })
}

// 新增商品信息
export function addInfopi(data) {
  return request({
    url: '/shopping/goods',
    method: 'post',
    data: data
  })
}

// 修改商品信息
export function updateInfopi(data) {
  return request({
    url: '/shopping/goods',
    method: 'put',
    data: data
  })
}

// 删除商品信息
export function delInfopi(productId) {
  return request({
    url: '/shopping/goods/' + productId,
    method: 'delete'
  })
}

// 删除商品标签
export function removelab(labelId) {
  return request({
    url: '/shopping/product/removelab/' + labelId,
    method: 'delete'
  })
}

// 导出商品信息
export function exportInfopi(query) {
  return request({
    url: '/shopping/goods/exportpi',
    method: 'get',
    params: query
  })
}

export function publishStatusUpdate(productId, publishStatus) {
  const data = {
    productId,
    publishStatus
  }
  return request({
    url: '/shopping/goods/publishStatus',
    method: 'put',
    data: data
  })
}

export function auditStatusUpdate(productId, auditStatus) {
  const data = {
    productId,
    auditStatus
  }
  return request({
    url: '/shopping/goods/auditStatus',
    method: 'put',
    data: data
  })
}


// 查询商品图片信息列表
export function listppi(query) {
  return request({
    url: '/shopping/product/listppi',
    method: 'get',
    params: query
  })
}

// 查询商品标签列表
export function listLabel(productId) {
  return request({
    url: '/shopping/product/labellist/'+productId,
    method: 'get',
  })
}

// 查询商品标签详细
export function getLabel(labelId) {
  return request({
    url: '/shopping/product/label/' + labelId,
    method: 'get'
  })
}

// 新增商品标签
export function addLabel(data) {
  return request({
    url: '/shopping/label',
    method: 'post',
    data: data
  })
}

// 修改商品标签
export function updateLabel(data) {
  return request({
    url: '/shopping/label',
    method: 'put',
    data: data
  })
}


// 商品图片查询
export function listppict(productId) {
  return request({
    url: '/shopping/productPict/listppi/'+productId,
    method: 'get',
  })
}


// 查询商品图片信息详细
export function getInfoPic(productPicId) {
  return request({
    url: '/shopping/productPict/' + productPicId,
    method: 'get'
  })
}

// 新增商品图片信息
export function addInfoPic(data) {
  return request({
    url: '/shopping/productPict',
    method: 'post',
    data: data
  })
}
//查询商品产品信息图片
export function getProductDetailsImgById(productPicId){
  return request({
    url: '/shopping/productDetails/listDetailsImg/' +productPicId,
    method: 'get',
  })
}
//新增商品产品信息图片
export function addProductDetailsImg(data){
  return request({
    url: '/shopping/productDetails',
    method: 'post',
    data: data
  })
}

//移除商品产品信息图片
export function deleteDetailsImgByName(data){
  return request({
    url: '/shopping/productDetails/deleteDetailsImgByName',
    method: "delete",
    data: data
  })
}

// 修改商品图片信息
export function updateInfoPic(data) {
  return request({
    url: '/shopping/productPict',
    method: 'put',
    data: data
  })
}

// 删除商品图片信息
export function delInfoPic(productPicId) {
  return request({
    url: '/shopping/productPict/' + productPicId,
    method: 'delete'
  })
}


// 上传图片
export function uploadImage(data) {
  return request({
    url: '/shopping/productPict/uploadImage',
    method: 'post',
    data: data
  })
}




